package com.systop.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.systop.entity.Consignee;
import com.systop.entity.SysUser;
import com.systop.dao.ConsigneeDao;
import com.systop.service.ConsigneeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ConsigneeServiceImpl extends ServiceImpl<ConsigneeDao,Consignee> implements ConsigneeService {
    @Autowired
    private ConsigneeDao consigneeDao;
    //返回页面查询数据
    @Override
    public List<Consignee> showConsigneeInfo(Consignee consignee) {
        return consigneeDao.showConsigneeInfo(consignee);
    }
    //通过用户名查询Id
    public Long findIdByUserCode(String userCode){
        return consigneeDao.findIdByUserCode(userCode);
    };
    //查询总数
    public int countAllConsignee(Consignee consignee){
        return consigneeDao.countAllConsignee(consignee);
    };
    //返回添加修改下拉框数据
    public List<SysUser> findAllSysUserName(){
        return consigneeDao.findAllSysUserName();
    };


    //查看订单中是否存在相关收货人，有的话禁止删除
    public int findOrder(Long consigneeId){
        return consigneeDao.findOrder(consigneeId);
    };
    //删除收货人信息
    public int delConsignee(Long consigneeId){
        return consigneeDao.delConsignee(consigneeId);
    };

    //添加收货相关信息
    public int addConsignee(Consignee consignee){
        return consigneeDao.addConsignee(consignee);
    };

    //修改收货人相关信息
    public int updConsignee(Consignee consignee){
        return consigneeDao.updConsignee(consignee);
    }

}
